<script lang="ts">
	// import { hello, Stack } from './栈'
	let items = [0, 1];
	$: l = items.length - 1;
	let i = 2;
	function push() {
		items.push(i);
		items = items;
		console.log(items);
		i++;
		console.log(i);
	}
	function pop() {
		items.pop();
		i--;
		items = items;
	}
	function shift() {
		items.shift();
		items = items;
	}
</script>

<!-- {hello} -->
<!-- {stack}
{stack_name} -->

<p>
	栈里的数据
	{#each items as item, i}
		<div class={i == l ? 'mx-3 text-red-600 inline-block' : ' inline-block mx-3'}>{item}</div>
	{/each}
</p>

<button on:click={push}>进栈</button>
<button on:click={pop}>出栈</button>
<button on:click={shift}>出列</button>
